package com.thinkmore.business.bean;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import java.time.LocalDateTime;

public class User extends BaseEntity implements Serializable {
    private String id;
    private String userName;
    private String password;
    @Length(min = 4, max = 20, message = "昵称长度只能在4-20之间")
    private String nickName;
    private String mobile;
    private String email;
    private Integer stat;
    private Role role;

    public User() {
    }

    public User(String id, Role role, String userName, String password, String nickName, String mobile, String email, LocalDateTime ctime) {
        this.id = id;
        this.role = role;
        this.userName = userName;
        this.password = password;
        this.nickName = nickName;
        this.mobile = mobile;
        this.email = email;
        this.setCtime(ctime);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getStat() {
        return stat;
    }

    public void setStat(Integer stat) {
        this.stat = stat;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }
}
